package cn.yuxiaoyuan.article.service.impl;

import cn.yuxiaoyuan.article.dao.CommentRepository;
import cn.yuxiaoyuan.article.mongo.Comment;
import cn.yuxiaoyuan.article.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class CommentServiceImpl implements CommentService {
    @Autowired
    private CommentRepository commentRepository;

    @Override
    public void save(Comment comment) {
        commentRepository.save(comment);
    }

    @Override
    public void update(Comment comment) {
        commentRepository.save(comment);
    }

    @Override
    public void del(String  id) {
        commentRepository.deleteById(id);
    }

    @Override
    public List<Comment> findByArticleId(Long id) {
        return commentRepository.findByArticleId(id);
    }

    @Override
    public List<Comment> findAll() {
        return commentRepository.findAll();
    }
}
